<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

return [
    'id' => 'app-frontend',

    'basePath' => dirname(__DIR__),

    'bootstrap' => ['log'],

     //设置语言包
    'language'=>'zh-CN',

    #设置默认命名空间
    'controllerNamespace' => 'frontend\controllers',

    //设置默认 访问控制器
    // 'defaultRoute'=>'index',

    // 阻件
    'components' => [
        #view 阻件  themes
        // 'view' => [
        //     #theme 主题设置
        //     'theme' => [
        //         'pathMap' => ['@frontend/views' => '@frontend/themes/t_blog/views'],
        //         'baseUrl' => '@web/themes/t_blog',
        //     ],
        // ],

        'user' => [
            // 'identityClass' => 'common\models\User',
            'identityClass' => 'common\models\UserModel',
            'enableAutoLogin' => true,  #保持自动登录
        ],

        #日志
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],

        #错误处理
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],

        #url美化
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            // 'suffix'=>'.html',
            'rules' => [
            ],
        ],

        #语言设置
        'i18n' => [
            'translations' => [
                'common' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                    //'basePath' => '/messages',
                    'fileMap' => [
                        'common' => 'common.php',
                    ],
                ],
                // 'power' => [
                //     'class' => 'yii\i18n\PhpMessageSource',
                //     //'basePath' => '/messages',
                //     'fileMap' => [
                //         'power' => 'power.php',
                //     ],
                // ],
            ],
        ],
    ],

    #参数，开关引入的地址
    'params' => $params,
];
